]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
js: Cleanup use of StBin
authorZander Brown <zbrown@gnome.org>
Wed, 8 Nov 2023 10:20:03 +0000 (10:20 +0000)
committerMarge Bot <marge-bot@gnome.org>
Fri, 10 Nov 2023 20:19:13 +0000 (20:19 +0000)
StBins (inc StButton) should have their content managed via :child
rather than add_child()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3010>

js/ui/altTab.js
js/ui/dash.js
js/ui/dateMenu.js
js/ui/magnifier.js
js/ui/pageIndicators.js
js/ui/search.js
js/ui/status/keyboard.js

index 21dba9d3f3ffdbb46a25fe74b5810c40e0938a24..0e64d65ee8c3988de74eb870b654ac3a0a8a0211 100644 (file)
@@ -965,7 +965,7 @@ class ThumbnailSwitcher extends SwitcherPopup.SwitcherList {
 
             let clone = _createWindowClone(mutterWindow, thumbnailSize);
             this._thumbnailBins[i].set_height(binHeight);
-            this._thumbnailBins[i].add_child(clone);
+            this._thumbnailBins[i].child = clone;
 
             mutterWindow.connectObject('destroy',
                 source => this._removeThumbnail(source, clone), this);
index 8f4c2a95c7f3910b8850a4c9f914eb36ed952edc..3cdc0b5af1b6a0e45f2e090004ad61773e97bbf7 100644 (file)
@@ -210,7 +210,7 @@ class ShowAppsIcon extends DashItemContainer {
         });
         this.icon.y_align = Clutter.ActorAlign.CENTER;
 
-        this.toggleButton.add_child(this.icon);
+        this.toggleButton.child = this.icon;
         this.toggleButton._delegate = this;
 
         this.setChild(this.toggleButton);
index 53134deb6c0407a73aec5dd304ce2042a2ef7b7f..0ffd73c76e76366e49802141287b86a3d9f5453d 100644 (file)
@@ -64,7 +64,7 @@ class TodayButton extends St.Button {
         });
 
         const hbox = new St.BoxLayout({vertical: true});
-        this.add_child(hbox);
+        this.child = hbox;
 
         this._dayLabel = new St.Label({
             style_class: 'day-label',
index ce03e3cd7edaf070cfe10dc459c0b61638b52890..522b201fee698fabb720050987b55a5dbc0e8b5c 100644 (file)
@@ -1469,17 +1469,19 @@ class ZoomRegion {
     // Private methods //
 
     _createActors() {
+        // Add a group to clip the contents of the magnified view.
+        const mainGroup = new Clutter.Actor({clip_to_allocation: true});
+
         // The root actor for the zoom region
-        this._magView = new St.Bin({style_class: 'magnifier-zoom-region'});
+        this._magView = new St.Bin({
+            style_class: 'magnifier-zoom-region',
+            child: mainGroup,
+        });
         global.stage.add_child(this._magView);
 
         // hide the magnified region from CLUTTER_PICK_ALL
         Shell.util_set_hidden_from_pick(this._magView, true);
 
-        // Add a group to clip the contents of the magnified view.
-        let mainGroup = new Clutter.Actor({clip_to_allocation: true});
-        this._magView.set_child(mainGroup);
-
         // Add a background for when the magnified uiGroup is scrolled
         // out of view (don't want to see desktop showing through).
         this._background = new Background.SystemBackground();
index 38b812a6ead1662bc37e2b94b46f67ffa352c5e4..af3ee14ca80cdc24a94fd10bccb0320248082205 100644 (file)
@@ -62,10 +62,10 @@ export const PageIndicators = GObject.registerClass({
                                  St.ButtonMask.TWO |
                                  St.ButtonMask.THREE,
                     reactive: this._reactive,
-                });
-                indicator.child = new St.Widget({
-                    style_class: 'page-indicator-icon',
-                    pivot_point: new Graphene.Point({x: 0.5, y: 0.5}),
+                    child: new St.Widget({
+                        style_class: 'page-indicator-icon',
+                        pivot_point: new Graphene.Point({x: 0.5, y: 0.5}),
+                    }),
                 });
                 indicator.connect('clicked', () => {
                     this.emit('page-activated', pageIndex);
index 76918290cf5dbae4f168817598c6d483e2973188..2cc35734406cde5097e248c132a60816d5a88660 100644 (file)
@@ -304,7 +304,7 @@ class ListSearchResults extends SearchResultsBase {
         });
         this._container.add_child(this._content);
 
-        this._resultDisplayBin.set_child(this._container);
+        this._resultDisplayBin.child = this._container;
     }
 
     _setMoreCount(count) {
@@ -468,10 +468,10 @@ class GridSearchResults extends SearchResultsBase {
             this._grid.layout_manager.spacing = node.get_length('spacing');
         });
 
-        this._resultDisplayBin.set_child(new St.Bin({
+        this._resultDisplayBin.child = new St.Bin({
             child: this._grid,
             x_align: Clutter.ActorAlign.CENTER,
-        }));
+        });
 
         this._maxResults = provider.maxResults ?? -1;
     }
@@ -588,9 +588,11 @@ export const SearchResultsView = GObject.registerClass({
             x_align: Clutter.ActorAlign.CENTER,
             y_align: Clutter.ActorAlign.CENTER,
         });
-        this._statusBin = new St.Bin({y_expand: true});
+        this._statusBin = new St.Bin({
+            y_expand: true,
+            child: this._statusText,
+        });
         this.add_child(this._statusBin);
-        this._statusBin.add_child(this._statusText);
 
         this._highlightDefault = false;
         this._defaultResult = null;
index 7436326b976cb8a0d4929be7036fd2420d1d14d7..cad5f2a869a6e94e81565a61b3b8fca210e687ab 100644 (file)
@@ -125,14 +125,15 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList {
     _addIcon(item) {
         let box = new St.BoxLayout({vertical: true});
 
-        let bin = new St.Bin({style_class: 'input-source-switcher-symbol'});
-        let symbol = new St.Label({
-            text: item.shortName,
-            x_align: Clutter.ActorAlign.CENTER,
-            y_align: Clutter.ActorAlign.CENTER,
+        const symbol = new St.Bin({
+            style_class: 'input-source-switcher-symbol',
+            child: new St.Label({
+                text: item.shortName,
+                x_align: Clutter.ActorAlign.CENTER,
+                y_align: Clutter.ActorAlign.CENTER,
+            }),
         });
-        bin.set_child(symbol);
-        box.add_child(bin);
+        box.add_child(symbol);
 
         let text = new St.Label({
             text: item.displayName,